#1.查看股价大于20的企业
#打开stock.csv
with open('stock.csv','r',encoding='utf-8') as f:
    #跳过第一行
    f.readline()
    #接着往下读
    for line in f:
        #去掉每行末尾的换行符
        line = line.strip()
        #以逗号分隔每行数据
        items = line.split(',')[2]
        #取出股价
        price = float(items)
        #如果股价大于20
        if price > 20:
            #打印公司名称和股价并保存为新文件
            print(line)
            with open('stock_price_gt_20.csv','a',encoding='utf-8') as f2:
                f2.write(line+'\n')

#结果 SH688566,吉贝尔,52.66,+6.96,+15.23%,+122.29%,1626.58万,8.09亿,42.29%,89.34,-,98.44亿
#SH688268,华特气体,88.80,+11.72,+15.20%,+102.51%,622.60万,5.13亿,22.87%,150.47,-,106.56亿
